import Row from "../qbasics/basics/Row";
import  LexCore from "./LexCore"
import fs from 'fs';
const readline = require('readline')

const path = require('path');
let fsPath=path.join(__dirname ,"./测试.jsr" )
let lexCore=new LexCore();
lexCore.init();



function read() {
    let data=fs.readFileSync(fsPath);
    lexCore.loadData(data)
}
function write() {

    let data=fs.writeFileSync(fsPath,lexCore.outData());
}

let str="把选中的字,移动到最后"
// let ids= lexCore.run(str);
// console.log(ids)
debugger
//添加词
lexCore.addIder("选中","词")
lexCore.addIder("移动","词")
lexCore.addIder("最后","词")
lexCore.addIder("把","词")
lexCore.addIder("到","词")
lexCore.addIder("的","词")
lexCore.addIder("字","词")
lexCore.addIder(",","词")
//添加语法类型
lexCore.iderAddType("选中","名词")
lexCore.iderAddType("移动","动词")
lexCore.iderAddType("最后","名词")
lexCore.iderAddType("把","结构")
lexCore.iderAddType("到","结构")
lexCore.iderAddType("的","结构")
lexCore.iderAddType("字","结构")
lexCore.iderAddType(",","结构")
debugger;
let ides=lexCore.lexRun(ids);


let yaccType=lexCore.yaccType(ides);
console.table(ides)
console.log(yaccType)
let srt1=[{type:'把',        'data':'把'},
           {type:'名词',     'data':'选中'},
           {type:'的',       'data':'的'},
           {type:'名词',     'data':'字'},
           {type:'动词',     'data':'移动'},
           {type:'到',       'data':'到'},
           {type:'名词',     'data':'最后'}]

